import React from 'react';
import ReactEcharts from '@/components/Echarts';

const InterviewMode = ({ data }) => {
    const getOption = () => ({
        tooltip: {
            trigger: 'item',
            formatter(params) {
                const html = `<div><i style="display: inline-block;vertical-align: middle;width:8px;height:8px;border-radius: 100%;margin-right:6px;background:${params.color};"></i><span style="color:#aaa">${params.name}：</span><span>${params.percent}%</span></div>`;
                return html;
            }
        },
        // legend: {
        //     data: data.map(item => item.name)
        // },
        series: [
            {
                name: '面试方式分析',
                type: 'pie',
                radius: ['30%', '70%'],
                center: ['50%', '60%'],
                data,
                label: {
                    normal: {
                        formatter: '{b}\n{d}%'
                    }
                },
                labelLine: {
                    normal: {
                        lineStyle: {
                            color: 'rgba(0,0,0,.3)'
                        }
                    }
                }
            }
        ]
    });
    return <ReactEcharts option={getOption(data)} />;
};

export default InterviewMode;
